<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui">

	<ui:composition template="/templates/masterLayout.xhtml">
		<ui:define name="content">
			<h:form id="loaiSanPhamListFormId">
				<p:dataTable id="loaiSanPhamDataTableId" value="#{loaiSanPhamView.dataModel}"
					selection="#{loaiSanPhamView.selectedEntities}" paginator="true" var="entity" rows="10"
					paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
					lazy="true" paginatorPosition="bottom">
					<p:ajax event="rowDblselect" listener="#{loaiSanPhamView.editAction}" partialSubmit="true"
						oncomplete="loaiSanPhamDialog.show()" update=":loaiSanPhamDetailFormId:loaiSanPhamPanelGridId" />
					<f:facet name="header">
						<p:commandButton icon="ui-icon-plus" value="Tạo mới" action="#{loaiSanPhamView.newAction}"
							actionListener="#{loaiSanPhamView.reset}" update=":loaiSanPhamDetailFormId:loaiSanPhamPanelGridId"
							oncomplete="loaiSanPhamDialog.show()" style="float:left" />
						<div style="clear: both;" />
					</f:facet>

					<p:column selectionMode="multiple" style="width:1%" />

					<p:column headerText="Mã số" sortBy="#{entity.code}" filterBy="#{entity.code}">
						<h:outputText value="#{entity.code}" />
					</p:column>

					<p:column headerText="Tên" sortBy="#{entity.name}" filterBy="#{entity.name}">
						<h:outputText value="#{entity.name}" />
					</p:column>

					<p:column headerText="Chi nhánh" sortBy="#{entity.chiNhanh.name}">
						<h:outputText value="#{entity.chiNhanh.name}" />
					</p:column>
					<f:facet name="footer">
					</f:facet>
				</p:dataTable>

				<p:confirmDialog id="loaiSanPhamDeleteConfirmDialogId" message="Bạn muốn xóa sản phẩm?"
					header="Xác nhận xóa sản phẩm" severity="alert" widgetVar="loaiSanPhamDeleteConfirmDialog">

					<p:commandButton id="deleteYesId" value="Yes" update=":loaiSanPhamListFormId:loaiSanPhamDataTableId"
						oncomplete="loaiSanPhamDeleteConfirmDialog.hide()" action="#{loaiSanPhamView.deleteAction}" />
					<p:commandButton id="deleteNoId" value="No" immediate="true" onclick="loaiSanPhamDeleteConfirmDialog.hide()"
						type="button" />
				</p:confirmDialog>
			</h:form>

			<ui:include src="loaiSanPhamDetails.xhtml" />
		</ui:define>
	</ui:composition>


</ui:composition>